#ifndef ABCLISTVIEWBAR_H
#define ABCLISTVIEWBAR_H

#include <QtGui>
#include <QString>
#if QT_VERSION >= 0x050000
#include <QWidget>
#endif
#ifdef STRABC
#else
    #define CHAR_LIST "*ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#endif

class ABCListViewBar : public QWidget
{
    Q_OBJECT
public:
    explicit ABCListViewBar(QWidget *parent = 0);

signals:
#ifdef STRABC
    void    ABCChanged(QString str);
#else
    void    ABCChanged(char c);
#endif
    void    ABCTipStart();
    void    ABCTipEnd();

public slots:

public:
    void setCharSize(int size);

private:
    void    OnInitWidget();
    void    OnDrawBar(QPainter &painter);

protected:
    void    paintEvent(QPaintEvent *event);
    void    mousePressEvent(QMouseEvent *event);
    void    mouseMoveEvent(QMouseEvent *event);
    void    mouseReleaseEvent(QMouseEvent *event);

private:
#ifdef STRABC
    int     CHAR_NUM;
    float   mCharHeight;
    int     mCurIdx;
    const char **mChar;
#else
    static const char mChar[sizeof(CHAR_LIST)];
    #define CHAR_NUM  (sizeof(mChar)-1)
    float     mCharHeight;
    int     mCurIdx;
#endif
    //int mBarHeight;
    int mCharSize;

};

#endif // ABCLISTVIEWBAR_H
